<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('profit列表')" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
<!--                            <li>-->
<!--                                <label>：</label>-->
<!--                                <input type="text" name="infoId"/>-->
<!--                            </li>-->
                            <li>
                                <label>机构：</label>
                                <select name="infoId"  class="form-control">
                                    <option value="">所有</option>
                                    <option  th:each="item:${typeMapList}" th:text="${item.infoName}" th:value="${item.infoId}"></option>
                                </select>
                            </li>
                            <li>
                                <label>日期：</label>
                                <input type="text" id="dateInfo" name="dateInfo" autocomplete="off"/>
                            </li>

                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

<!--            <div class="btn-group-sm" id="toolbar" role="group">-->
<!--                <a class="btn btn-success" onclick="$.operate.add()">-->
<!--                    <i class="fa fa-plus"></i> 添加-->
<!--                </a>-->
<!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="form:profit:edit">-->
<!--                    <i class="fa fa-edit"></i> 修改-->
<!--                </a>-->
<!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="form:profit:remove">-->
<!--                    <i class="fa fa-remove"></i> 删除-->
<!--                </a>-->
<!--                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="form:profit:export">-->
<!--                    <i class="fa fa-download"></i> 导出-->
<!--                </a>-->
<!--            </div>-->
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
     <th:block th:include="include :: select2-js" />
    <script th:inline="javascript">
        // var editFlag = [[${@permission.hasPermi('form:profit:edit')}]];
        // var removeFlag = [[${@permission.hasPermi('form:profit:remove')}]];
        var prefix = ctx + "form/profit";

        $(function() {
            var options = {
                url: prefix + "/list",
                // createUrl: prefix + "/add/"+$("#infoId").val(),
                updateUrl: prefix + "/edit/{id}",
                // removeUrl: prefix + "/remove",
                // exportUrl: prefix + "/export",
                modalName: "收益列表",
                columns: [
                //     {
                //     checkbox: true
                // },
                // {
                //     field: 'id',
                //     title: '',
                //     visible: false
                // },
                {
                    field: 'infoName',
                    title: '名称'
                },
                {
                    field: 'dateInfo',
                    title: '日期'
                },
                // {
                //     field: 'matchNumber',
                //     title: '流量信息',
                //     formatter: function(value, row, index) {
                //         return '总流量：' + row.totalNumber + '</br>'
                //         + '过筛失败量：' + row.filterErrorNumber + '</br>'
                //         + '撞库失败量：' + row.matchErrorNumber + '</br>'
                //         + '待确认量：' + row.waitConfirmNumber + '</br>'
                //         + '推送失败量：' + row.pushErrorNumber + '</br>'
                //         + '超时量：' + row.timeoutNumber + '</br>'
                //     }
                // },
                // {
                //     field: 'registerNumber',
                //     title: '推送量'
                // },
                {
                    field: 'totalNumber',
                    title: '总流量'
                },
                    {
                        field: 'filterErrorNumber',
                        title: '过筛失败量'
                    },
                    {
                        field: 'matchErrorNumber',
                        title: '撞库失败量'
                    },
                    {
                        field: 'waitConfirmNumber',
                        title: '待确认量'
                    },
                    {
                        field: 'pushErrorNumber',
                        title: '推送失败量'
                    },
                    {
                        field: 'timeoutNumber',
                        title: '超时量'
                    },

                {
                    field: 'pushSuccessNumber',
                    title: '推送成功量'
                },
                {
                    field: 'profitAmount',
                    title: '收益'
                },
                {
                    field: 'avgAmount',
                    title: '平均收益'
                },
                    {
                        title: '操作',
                        align: 'center',
                        formatter: function(value, row, index) {
                            var actions = [];
                            if (row.dateInfo != '-'){
                                actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                            }
                            // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                            return actions.join('');
                        }
                    }
                ]
            };
            $.table.init(options);
        });


        layui.use('laydate', function(){
            var laydate = layui.laydate;

            laydate.render({
                elem: '#dateInfo',
                type: 'date',
                range: '~'
                // ,min: -7 //7天前
                ,max: 0
            });

        });
    </script>
</body>
</html>